/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
var deleteDuplicates = function (head) {
  let dummyHead = new ListNode()
  dummyHead.next = head
  let cur = head
  while (head && head.next) {
    next = cur.next
    for (; next.val == cur.val && next.next; next = next.next) {

    }
    cur.next = next

    cur = cur.next

  }
  return dummyHead.next
};